
package com.kweative.model.column;

import com.kweative.model.Table;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author henrik
 */
public class ColumnUrl<T extends Table> extends ColumnText<T> {

    public ColumnUrl(String name) {
        this();
		setName(name);
    }

	public ColumnUrl() {
		super(120);
	}


    @Override
    public String serialize(Object value) {
        if (value == null) return null;
        URL u = (URL) value;
        
        return super.serialize(u.toString());
    }

    @Override
    public URL unserialize(String value) {
        if (value == null || value.length() == 0) return null;
        try {
            return new URL(value);
        } catch (MalformedURLException ex) {
            Logger.getLogger(ColumnUrl.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }


}
